import request from '@/config/axios'
import type { Dayjs } from 'dayjs'

/** 套餐维度模板 */
export interface PackageCategory {
  id: number // 编号
  name?: string // 维度名称
  table_model?: string // 表类型
  creator?: string // 创建者
  create_time?: Date // 创建时间
  updater?: string // 更新者
  update_time?: Date // 更新时间
  deleted?: number // 是否删除
}

// 套餐维度模板 API
export const PackageCategoryApi = {
  getPackageCategoryList: async (params: any) => {
    return await request.get({ url: `/system/package-category/simple-list`, params })
  },
  // 查询套餐维度模板文件分页
  getPackageCategoryPage: async (params: any) => {
    return await request.get({ url: `/system/package-category/page`, params })
  },

  // 查询套餐维度模板文件详情
  getPackageCategory: async (id: number) => {
    return await request.get({ url: `/system/package-category/get?id=` + id })
  },

  // 新增套餐维度模板文件
  createPackageCategory: async (data: PackageCategory) => {
    return await request.post({ url: `/system/package-category/create`, data })
  },

  // 修改套餐维度模板文件
  updatePackageCategory: async (data: PackageCategory) => {
    return await request.put({ url: `/system/package-category/update`, data })
  },

  // 删除套餐维度模板文件
  deletePackageCategory: async (id: number) => {
    return await request.delete({ url: `/system/package-category/delete?id=` + id })
  },

  /** 批量删除套餐维度模板文件 */
  deletePackageCategoryList: async (ids: number[]) => {
    return await request.delete({
      url: `/system/package-category/delete-list?ids=${ids.join(',')}`
    })
  },

  // 导出套餐维度模板文件 Excel
  exportPackageCategory: async (params) => {
    return await request.download({ url: `/system/package-category/export-excel`, params })
  },
  // /package-category/get-category-items
  getCategoryItems: async (categoryName: string) => {
    return await request.get({
      url: `/system/package-category/get-category-items`,
      params: { categoryName }
    })
  }
}
